<template>
  <div>
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="角色名称">
        <el-input v-model="form.Name"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">修改</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    Rid: null,
  },
  data() {
    return {
      form: {},
    };
  },
  created() {
    this.GetRoleInfoById();
  },
  methods: {
    GetRoleInfoById() {
      this.axios
        .get("http://localhost:5255/api/Role/GetRoleById?Id=" + this.Rid)
        .then((res) => {
          this.form = res.data.Data;
        });
    },
    onSubmit() {
      this.axios
        .put("http://localhost:5255/api/Role/UpdateRole", this.form)
        .then((res) => {
          if (res.data.Success) {
            this.$message.success(res.data.ErrorInfo);
            this.$emit("CloseRoleUpdDia");
          } else {
            this.$message.error(res.data.ErrorInfo);
          }
        });
    },
  },
};
</script>

<style>
</style>